@extends('backend/layouts/default')
@section('title')
{{empty($data['contest']->id) ? "Thêm sự kiện mới":"Sửa sự kiện"}}
@stop
@section('content')
<h3>
    <span
        class="glyphicon glyphicon-user"></span> <?= !empty($data['contest']->id) ? "Sửa sự kiên" : "Thêm mới sự kiện"; ?>
</h3>
@if(Session::has('success'))
<h3>{{Session::get('success')}}</h3>
@endif
<form class="form-horizontal" action="" method="post" role="form">
    <input type="hidden" value="<?= $data['contest']->id ?>" name="data[Contest][id]"/>

    <div class="row">
        <div class="col-md-9">
            <div class="form-group <?= $errors->has('title') ? 'error' : '' ?>">
                <label class="control-label col-sm-4">Tiêu đề</label>

                <div class="col-sm-8">
                    <input type="text" name="data[Contest][title]" id="data[Contest][title]" class="form-control"
                           value="<?= $data['contest']->title ?>"/>
                    <?= $errors->first('title', '<span class="help-inline">:message</span>') ?>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">
                    Bắt đầu
                </label>

                <div class="col-sm-8">
                    <input type="text" name="data[Contest][start]" class="form-control" value=""/>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">
                    Kết thúc
                </label>

                <div class="col-sm-8">
                    <input type="text" name="data[Contest][end]" class="form-control" value=""/>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">
                    Giải thưởng
                </label>

                <div class="col-sm-8">
                    <div class="form-group">
                        <label class="control-label col-sm-4">
                            Giải nhất
                        </label>

                        <div class="col-sm-4">
                            <input type="text" name="data[Contest][award_1]" class="form-control"
                                   value="<?= $data['contest']->award_1 ?>"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-4">
                            Giải nhì
                        </label>

                        <div class="col-sm-4">
                            <input type="text" name="data[Contest][award_2]" class="form-control"
                                   value="<?= $data['contest']->award_2 ?>"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-sm-4">
                            Giải ba
                        </label>

                        <div class="col-sm-4">
                            <input type="text" name="data[Contest][award_2]" class="form-control"
                                   value="<?= $data['contest']->award_2 ?>"/>
                        </div>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">
                    Thể lệ
                </label>

                <div class="col-sm-8">
                    <textarea name="data[Contest][rules]" id="textareabox" class="form-control">
                        <?= $data['contest']->rules ?>
                    </textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4">Trạng thái</label>

                <div class="col-sm-8">
                    <?= Form::select('data[Contest][status]', array('on' => 'Hiển thị', 'off' => 'Không hiển thị'), Input::old('data[Contest][status]', $data['contest']->status), array('class' => 'form-control')) ?>
                </div>
            </div>
            <div class="control-group" align="right">
                <div class="controls">
                    <a class="btn btn-link" href="{{ route('contests/admin') }}">Hủy</a>
                    <button type="submit" class="btn btn-success">Lưu</button>
                </div>
            </div>
        </div>
    </div>
</form>
@stop